import service from "@/api/index.js";
import qs from "qs";

const adminApi = {
    //获取验证码
    captcha() {
        return service.get("/admin/captcha");
    },
    //登录
    login(admin) {
        return service.post("/admin/login", qs.stringify(admin));
    },
    //获取已登录用户信息
    getInfo() {
        return service.get("/admin/info")
    },
    //修改密码
    chaPwd(chgPwdObj) {
        return service.put("/admin/chgPwd", qs.stringify(chgPwdObj))
    },
    //修改信息
    chgInfo(admin) {
        return service.put("/admin/chgInfo", admin);
    },
    //查询所有管理员
    All(admin, pageNum, pageSize) {
        admin.pageNum = pageNum
        admin.pageSize = pageSize
        return service.get("/admin", {
            params: admin
        });
    },
    //修改状态
    update(id) {
        return service.put(`/admin/${id}`);
    }
};

export default adminApi;